package org.testmyapp.entities;

import java.io.Serializable;

public class TaskWorkerUIBeanPk implements Serializable {

	public String processDefinitionKey;
	public String taskDefinitionKey;

	public TaskWorkerUIBeanPk() {

	}
	
	public TaskWorkerUIBeanPk(String processDefinitionKey, String taskDefinitionKey) {
		this.processDefinitionKey = processDefinitionKey;
		this.taskDefinitionKey = taskDefinitionKey;
	}

	@Override
	public boolean equals(Object other) {
		if (other == null) {
			return false;
		}
		if (!other.getClass().equals(this.getClass())) {
			return false;
		}
		TaskWorkerUIBeanPk otherObject = (TaskWorkerUIBeanPk) other;
		if (otherObject == this) {
			return true;
		}
		if (processDefinitionKey != null
				&& otherObject.processDefinitionKey != null
				&& processDefinitionKey
						.equals(otherObject.processDefinitionKey)) {
			if(taskDefinitionKey != null
				&& otherObject.taskDefinitionKey != null
				&& taskDefinitionKey
						.equals(otherObject.taskDefinitionKey)) {
				return true;
			}
		}
			return false;
	}
	
	@Override
	public int hashCode() {
		if(processDefinitionKey == null || taskDefinitionKey == null) {
			return 0;
		}
		else {
			return processDefinitionKey.hashCode() ^ taskDefinitionKey.hashCode();
		}
	}

}
